<?php

declare(strict_types=1);

namespace cms\office\request;

use cms\system\request\SceneValidatorRequest;
use Hyperf\Validation\Request\FormRequest;

class EnterpriseFormRequest extends FormRequest
{
    use SceneValidatorRequest;
    /**
     * Determine if the user is authorized to make this request.
     */
    public function authorize(): bool
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     */
    public function rules(): array
    {
        return [
            'name' => 'required|max:100',
            'alias' => 'required|max:100',
            'setting' => 'required',
        ];
    }

    public function scene(): array
    {
        return [
            // 创建场景
            'create' => [
                'name',
                'alias'
            ],
            // 更新场景
            'update' => [
                'name',
                'alias'
            ],
            // 设置场景
            'setting' => [
                'setting',
            ],
        ];
    }
}
